-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ObsUX] Add Missing transaction warning if there are Transactions or Spans with a parent.id that doesn't exist in the trace #171196
Conversation
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
7096e45
to
45317fa
Compare
…ransactions-are-missing
Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services) |
return ( | ||
<EuiToolTip | ||
position="left" | ||
delay="regular" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
regular
is the default value, so no need to specify this prop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, removed ✅
}, | ||
} as WaterfallTransaction; | ||
|
||
it('should return false if there is not orphan items', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it('should return false if there is not orphan items', () => { | |
it('should return false if there are no orphan items', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot that after I changed item with items, fixed 👍
expect(getHasOrphanTraceItems(traceItems)).toBe(false); | ||
}); | ||
|
||
it('should return true if there is orphan items', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it('should return true if there is orphan items', () => { | |
it('should return true if there are orphan items', () => { |
const waterfallItemsIds = traceDocs.map((doc) => | ||
doc.processor.event === 'span' | ||
? (doc?.span as WaterfallSpan['span']).id | ||
: doc?.transaction?.id | ||
); | ||
|
||
return traceDocs.some( | ||
(item) => item.parent?.id && !waterfallItemsIds.includes(item.parent?.id) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The waterfall itself is already very slow, WDYT of this change to speed this function up? With this you change it from O(n)
to O(1)
.
const waterfallItemsIds = traceDocs.map((doc) => | |
doc.processor.event === 'span' | |
? (doc?.span as WaterfallSpan['span']).id | |
: doc?.transaction?.id | |
); | |
return traceDocs.some( | |
(item) => item.parent?.id && !waterfallItemsIds.includes(item.parent?.id) | |
); | |
const waterfallItemsIds = new Set(traceDocs.map((doc) => | |
doc.processor.event === 'span' | |
? (doc?.span as WaterfallSpan['span']).id | |
: doc?.transaction?.id | |
)); | |
return traceDocs.some( | |
(item) => item.parent?.id && !waterfallItemsIds.has(item.parent.id) | |
); |
FYI: I did not test it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice idea, thank you! I changed that and tested it, looks good 👍
Pinging @elastic/apm-ui (Team:APM) |
…ransactions-are-missing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥳 🥳 Thanks for fixing it.
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
History
To update your PR or re-run it, just comment with: |
</EuiFlexItem> | ||
{hasOrphanTraceItems ? ( | ||
<EuiFlexItem grow={false}> | ||
<MissingTransactionWarning /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I suggest naming this OrphanTraceItemsWarning
to align with hasOrphanTraceItems
'xpack.apm.transactionDetails.agentMissingTransactionMessage', | ||
{ | ||
defaultMessage: | ||
'This trace contains spans from missing transactions. As a result these spans are not displayed in the timeline.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message is not entirely correct afaict. Example: a (parent) span could be missing, meaning that any child spans (or transactions) will not be displayed. So it is not just about missing transactions.
Also, we should suggest work-arounds for the user if possible.
Suggestion for error message:
This trace is incomplete and
{{count}}
items could not be displayed in the timeline. This could be a temporary problem caused by ingest delay, or a permanent problem caused by some events being dropped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, I remember I took the message from the issue description, and now that you mentioned that it makes sense. One question regarding the {{count}}
- we want to show the missing items in the waterfall based on the items returned and the items shown in the waterfall, right? I guess here we just calculate it, I don't see the missing items count existing somewhere (similar to the check we have here but instead of returning a boolean it should return the missing items count)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a draft PR for those changes so we can better discuss there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One question regarding the {{count}} - we want to show the missing items in the waterfall based on the items returned and the items shown in the waterfall, right? I guess here we just calculate it, I don't see the missing items count existing somewhere (similar to the check we have here but instead of returning a boolean it should return the missing items count)
Yes, I was thinking it would be beneficial to at least show the number of (orphan) items that cannot be placed because a parent is missing.
If it's difficult to calculate this, let's just skip it for now.
#173196) Closes #173134 ## Summary This PR is a follow-up to #171196 and changes the missing trace items tooltip message. <img width="1630" alt="image" src="https://github.com/elastic/kibana/assets/14139027/ae13547c-f2fb-4a19-8062-2774ea782111"> ## Testing Same as in #171196 (comment) but the message should be changed to the one in the screenshot here
Closes #25117
Summary
Add a missing transaction warning if there are Transactions or Spans with a
parent.id
that doesn't exist in the trace.Testing
trace_with_orphan_items.ts
scenario:node scripts/synthtrace --clean trace_with_orphan_items.ts
Incomplete trace (with warning):
Complete trace (no warning):